package main

import (
	"dlib"
	"dlib/dbus"
	"dlib/dbus/property"
	"dlib/gio-2.0"
)

type TestMouse struct {
	MoveAccuracy dbus.Property
}

func (mouse *TestMouse) GetDBusInfo() dbus.DBusInfo {
	return dbus.DBusInfo{
		"com.deepin.daemon.TestMouse",
		"/com/deepin/daemon/TestMouse",
		"com.deepin.daemon.TestMouse",
	}
}

func NewTestMouse() *TestMouse {
	mouse := TestMouse{}
	busConn, _ := dbus.SessionBus()
	mouseGSettings := gio.NewSettings("org.gnome.settings-daemon.peripherals.mouse")

	mouse.MoveAccuracy = property.NewGSettingsPropertyFull(mouseGSettings,
		"motion-threshold", int64(0), busConn,
		"/com/deepin/daemon/TestMouse",
		"com.deepin.daemon.TestMouse", "MoveAccuracy")

	return &mouse
}

func main() {
	mouse := NewTestMouse()
	dbus.InstallOnSession(mouse)
	dlib.StartLoop()
}
